package test.action;

import java.util.List;

import test.entity.Theme;
import test.service.ThemeService;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class ThemeAction extends ActionSupport implements ModelDriven<Theme>{

	private Theme theme = new Theme();
	private ThemeService themeService;
	
	public void setThemeService(ThemeService themeService) {
		this.themeService = themeService;
	}


	public Theme getModel() {	
		return theme;
	}

	
	public void add(){
		themeService.add(theme);
	}
	
	public String findAll(){
		List<Theme> tlist = themeService.findAll();
		ActionContext.getContext().getValueStack().set("tlist",tlist);
		return "success";
	}
}
